// 所有模块信息的配置项
export const allInfoTypes = [
  {
    key: "userInfo",
    label: "个人信息"
  },
  {
    key: "reserveInfo",
    label: "预约信息"
  }
];
// 根据当前类型获取对应的配置项（类型比如：预约类型、预警类型）
export const getInfoTypesByType = function(type) {
  let infoTypes = [];
  // 预警
  if (type === "warn") {
    infoTypes = ["userInfo"];
  }
  // 预约
  else if (type === "reserve") {
    infoTypes = ["userInfo", "reserveInfo"];
  }
  return allInfoTypes.filter(it => {
    return infoTypes.includes(it["key"]);
  });
};
export const getColumns = function(type) {
  let columnArr = [];
  switch (type) {
    // 个人信息
    case "userInfo":
      columnArr = [
        { field: "realName", label: "姓  名", span: 8 },
        { field: "code", label: "学  号", span: 8 },
        { field: "sexName", label: "性  别", span: 8 },
        { field: "gradeName", label: "年  级", span: 8 },
        { field: "classNo", label: "班  级", span: 8 },
        { field: "phone", label: "联系方式", span: 8 },
        { field: "tenantName", label: "学  校", span: 12 }
      ];
      break;
    // 预约信息
    case "reserveInfo":
      columnArr = [
        { field: "reserveType", label: "预约类型", span: 12 },
        { field: "reserveNo", label: "预约编号", span: 12 },
        { field: "reserveInitiateTime", label: "发起时间", span: 12 }
      ];
      break;
  }
  return columnArr;
};

// 获取接口信息
export const getUrl = function(hdType, btnType) {
  let urls = {
    // 预警类型
    warn: {
      // 提交
      submit: "/api/blade-measure/measure/userprojectgauge/saveInterveneInfo"
    }
  };
  return urls[hdType][btnType];
};
